#!/bin/bash

# using netstat and grep to detect www,SSH,FTP and Mail services.

# 告知
echo "Now, the services of your Linux system will be detece!"
echo -e "The www, ftp, ssh, and mail will be detece!\n"

# 开始测试，输出信息
testing=`netstat -tunl | grep ":80"`
if [ "$testing" != "" ]; then
    echo "WWW is running in your system."
fi

testing=`netstat -tunl | grep ":21"`
if [ "$testing" != "" ]; then
    echo "FTP is running in your system."
fi

testing=`netstat -tunl | grep ":22"`
if [ "$testing" != "" ]; then
    echo "SSH is running in your system."
fi

testing=`netstat -tunl | grep ":25"`
if [ "$testing" != "" ]; then
    echo "MAIL is running in your system."
fi
